package ch11_多线程与并发;

public class SleepDemo  {
	class Counter extends Thread{
		int i = 0;
		Counter(int i){
			this.i=i;
		}
		public void run() {
			while(i>=0) {
				System.out.print(i+"  ");
				try {
					Thread.sleep(1000);
				}catch(InterruptedException e) {
					System.out.println("休眠中的线程被打断！");
				}
				i--;
			}
		}
	}
	public static void main(String[] args) {
		System.out.println("倒计时开始：");
		new SleepDemo().new Counter(5).start();
	}

}
